﻿//Created by Action Script Viewer - http://www.buraks.com/asv
package com.fminutes.vinciDll.analyze {
    import flash.events.*;
    import com.fminutes.vinciDll.*;
    import flash.utils.*;
    import flash.display.*;

    public class MainAnalyze extends AnalyzeBase {

        private var mainList:Array;
        private var _dataDic:Dictionary;
        private var _dllFileDic:Dictionary;
        private var _funcDic:Dictionary;

        public function MainAnalyze(){
            this.mainList = [];
            super();
            this._dataDic = new Dictionary();
            this._dllFileDic = new Dictionary();
            this._funcDic = new Dictionary();
        }
        override public function analyze(_arg1:ByteArray, _arg2:DllFileObject, _arg3:Function):void{
            var _local4:Loader = new Loader();
            _local4.loadBytes(_arg1);
            _local4.contentLoaderInfo.addEventListener(Event.COMPLETE, this.onComplete);
            this._dataDic[_local4] = _arg1;
            this._dllFileDic[_local4] = _arg2;
            this._funcDic[_local4] = _arg3;
        }
        private function onComplete(_arg1:Event):void{
            var _local2:Loader = _arg1.target.loader;
            _arg1.target.removeEventListener(Event.COMPLETE, this.onComplete);
            this._dllFileDic[_local2].result = {
                data:this._dataDic[_local2],
                appDomain:_arg1.currentTarget.applicationDomain
            };
            if (this._dllFileDic[_local2].name == "main"){
                Dll.getInstance().mainAppDomain = _arg1.currentTarget.applicationDomain;
            };
            this._dllFileDic[_local2].status = DllFileObject.LOADED;
            this.mainList.push({
                fileObject:this._dllFileDic[_local2],
                fileLoader:_local2
            });
            var _local3 = this._funcDic;
            _local3[_local2]();
            delete this._dataDic[_local2];
            delete this._dllFileDic[_local2];
            delete this._funcDic[_local2];
        }
        public function getLoaderByName(_arg1:String):Loader{
            var _local3:DllFileObject;
            var _local2:int;
            while (_local2 < this.mainList.length) {
                _local3 = (this.mainList[_local2]["fileObject"] as DllFileObject);
                if (_local3.name == _arg1){
                    return ((this.mainList[_local2]["fileLoader"] as Loader));
                };
                _local2++;
            };
            return (new Loader());
        }

    }
}//package com.fminutes.vinciDll.analyze 
